using System;
using System.Collections.Generic;
using System.Security.Principal;

using SBPweb.Data;

namespace SBPweb.PROvibe.Resources.Entities
{
	public class Actor: Entity, IActor
	{

		#region Private fields

		private const string FIELDNAME_Id = "Id";
		private const string FIELDNAME_Name = "Name";
		private const string FIELDNAME_Email = "Email";
		private const string FIELDNAME_Password = "Password";
		private const string FIELDNAME_LastActivity = "LastActivity";

		#endregion

		#region Constructor logic

		static Actor()
		{
			RegisterEntityTypeToColumns(typeof(Actor));
		}

		public Actor()
            : base(null)
        {
		}

        public Actor(Actor entity)
            : base(entity)
        {
        }

		#endregion

		#region Public property accessors

		public virtual int Id
		{
			get
			{
				return GetValue<Int32>(FIELDNAME_Id);
			}
			set
			{
				SetValue<Int32>(FIELDNAME_Id, value);
			}
		}

		public virtual string Name
		{
			get
			{
				return GetValue<String>(FIELDNAME_Name);
			}
			set
			{
				SetValue<String>(FIELDNAME_Name, value);
			}
		}

		public virtual string Email
		{
			get
			{
				return GetValue<String>(FIELDNAME_Email);
			}
			set
			{
				SetValue<String>(FIELDNAME_Email, value);
			}
		}

		public virtual string Password
		{
			get
			{
				return GetValue<String>(FIELDNAME_Password);
			}
			set
			{
				SetValue<String>(FIELDNAME_Password, value);
			}
		}

		public virtual DateTime LastActivity
		{
			get
			{
				return GetValue<DateTime>(FIELDNAME_LastActivity);
			}
			set
			{
				SetValue<DateTime>(FIELDNAME_LastActivity, value);
			}
		}

		#endregion

		#region Overridden methods

		public override object Clone()
		{
			Actor actor = new Actor();

			actor.Email = this.Email;
			actor.Id = this.Id;
			actor.LastActivity = this.LastActivity;
			actor.Name = this.Name;
			actor.Password = this.Password;

			return actor;
		}

        public int CompareTo(IEntity other)
        {
            IActor o = other as IActor;
            if (o == null)
            {
                return 0;
            }
            return this.Id.CompareTo(o.Id);
        }

        public bool Equals(IEntity other)
        {
            IActor o = other as IActor;
            if (o == null)
            {
                return false;
            }
            return this.Id.Equals(o.Id);
        }

		#endregion

	}
}